#include "MapParser.h"

USING_NS_CC;

MapParser::MapParser()
{

}

MapParser::~MapParser()
{

}

// implement pure virtual methods of CCSAXDelegator
void MapParser::startElement(void *ctx, const char *name, const char **atts)
{
	CCTMXMapInfo::startElement(ctx,name,atts);
}

void MapParser::endElement(void *ctx, const char *name)
{
	CCTMXMapInfo::endElement(ctx,name);
}

/** creates a TMX Format with a tmx file */
MapParser * MapParser::formatWithTMXFile(const char *tmxFile)
{
	MapParser *pRet = new MapParser();
	if(pRet->initWithTMXFile(tmxFile))
	{
		pRet->autorelease();
		return pRet;
	}
	CC_SAFE_DELETE(pRet);
	return NULL;
}

/** creates a TMX Format with an XML string and a TMX resource path */
MapParser * MapParser::formatWithXML(const char* tmxString, const char* resourcePath)
{
	MapParser *pRet = new MapParser();
	if(pRet->initWithXML(tmxString, resourcePath))
	{
		pRet->autorelease();
		return pRet;
	}
	CC_SAFE_DELETE(pRet);
	return NULL;
}